import { useState } from "react";
import { Button, Text, View,TextInput, StyleSheet, ScrollView } from "react-native";
import messageList from "../api/data";
import { List } from "react-native-paper";

export default function Detile({navigation,route}){
    const { user } = route.params;
    const [text,setText] = useState();

    const msgDataList = messageList
    return(
        <View>
            {/* <Text style={{height:"93 %"}}>
                {JSON.stringify(user)}
            </Text> */}
            <View>
                <ScrollView>
                {msgDataList.map((item)=>(
                    <List.Item
                    title={item.name}
                    description = {item.msg}
                    />
                ))}
                </ScrollView>
            </View>


            <View style={styles.contained}>
            <TextInput
            style={{ height: 40,width:"87%", borderColor: 'gray', borderWidth: 1  }}
            value={text}
            onChangeText={text => setText(text)}
            />
<View style={styles.button}>
            <Button style={styles.button} title="发送" onPress={()=>{console.log(text);setText()}}  />
            </View>
            </View>
            <Button title="返回" onPress={()=>{navigation.pop()}}/>
        </View>
    )
}


const styles = StyleSheet.create({
    contained:{
        flexDirection:'row',
        justifyContent:"center",
        alignItems:"center",
    },
    button:{
        // paddingLeft:8,
        flexDirection:"row-reverse",
        height:41
    }
})